home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / disk / cdrom / MusicBox-2.1os.lha / MusicBox / MusicBoxARexx.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-29  |  4.7 KB  |  145 lines

  1. /*
  2.  ##########################################################################
  3.  ####                                                                  ####
  4.  ####                        The MusicBox Project                      ####
  5.  ####                    ============================                  ####
  6.  ####                                                                  ####
  7.  #### MusicBoxARexx.c                                                  ####
  8.  ####                                                                  ####
  9.  #### Version 2.1os  --  September 29, 2000                            ####
  10.  ####                                                                  ####
  11.  #### Copyright (C) 1994  Thomas Dreibholz                             ####
  12.  ####               2000  Molbachweg 7                                 ####
  13.  ####                     51674 Wiehl                                  ####
  14.  ####                     Germany                                      ####
  15.  ####                                                                  ####
  16.  ####                     EMail: Dreibholz@bigfoot.com                 ####
  17.  ####                     WWW:   http://www.bigfoot.com/~dreibholz     ####
  18.  ####                                                                  ####
  19.  ##########################################################################
  20. */
  21. /***************************************************************************
  22.  *                                                                         *
  23.  *   This program is free software; you can redistribute it and/or modify  *
  24.  *   it under the terms of the GNU General Public License as published by  *
  25.  *   the Free Software Foundation; either version 2 of the License, or     *
  26.  *   (at your option) any later version.                                   *
  27.  *                                                                         *
  28.  ***************************************************************************/
  29.  
  30. /* MusicBox ARexx-Port */
  31.  
  32. #include "MusicBox.h"
  33.  
  34. extern struct ThisCD        *ThisCD;
  35. extern struct Einstellungen  Einstellungen;
  36. extern struct MsgPort       *ARexxPort;
  37. extern BOOL                  IsIconify;
  38.  
  39. int ARexxHandler()
  40. {
  41.  REGISTER LONG    Res1,Res2;
  42.  REGISTER LONG    i,CmdCount,Pos;
  43.  UBYTE            Command[10][50];
  44.  UBYTE            c;
  45.  
  46.  struct RexxMsg  *rx;
  47.  int              iconify;
  48.  
  49.  rx=GetMsg(ARexxPort);
  50.  while(rx!=NULL)
  51.   {
  52.    /* --------------------------------------------------- */
  53.    Pos=0;
  54.    for(i=0,CmdCount=0;i<strlen(rx->rm_Args[0]);i++)
  55.     {
  56.      c=rx->rm_Args[0][i];
  57.      if(c==' ')
  58.       {
  59.        Command[CmdCount++][Pos]=0x00;
  60.        Pos=0;
  61.        if(CmdCount>9) break;
  62.       }
  63.      else
  64.       {
  65.        if(Pos<49) Command[CmdCount][Pos++]=toupper(c);
  66.       }
  67.     }
  68.    Command[CmdCount++][Pos]=0x00;
  69.    for(i=CmdCount;i<10;i++) *Command[i]=0;
  70.    Res1=0;
  71.    Res2=0;
  72.    iconify=0;
  73.    /* --------------------------------------------------- */
  74.    if(!(strcmp(&Command[0],"ICONIFY")))
  75.      iconify=1;
  76.    else if(!(strcmp(&Command[0],"UNICONIFY")))
  77.      iconify=2;
  78.    else if(!(strcmp(&Command[0],"ARCHIVE")))
  79.      Gesamtkatalog();
  80.    else if(!(strcmp(&Command[0],"CLICK")))
  81.     {
  82.      if(*Command[1]!=NULL)
  83.       {
  84.        if(!(strcmp(&Command[1],"PLAY")))
  85.         {
  86.          if(*Command[2]!=NULL)
  87.           {
  88.            i=atol(&Command[2]);
  89.            if(Einstellungen.Funktion!=STANDBY)
  90.             {
  91.              if((i>=1)&&(i<=ThisCD->Anzahl))
  92.              StopClicked();
  93.              Einstellungen.Track=i;
  94.              WiedergabeClicked();
  95.             }
  96.           }
  97.          else
  98.            WiedergabeClicked();
  99.         }
  100.        else if(!(strcmp(&Command[1],"STOP"))) StopClicked();
  101.        else if(!(strcmp(&Command[1],"EJECT"))) AuswurfClicked();
  102.        else if(!(strcmp(&Command[1],"NEXT"))) PlusClicked();
  103.        else if(!(strcmp(&Command[1],"PREV"))) MinusClicked();
  104.        else if(!(strcmp(&Command[1],"RND"))) TNumberClicked();
  105.        else if(!(strcmp(&Command[1],"LOCK")))
  106.         {
  107.          if(*Command[2]!=NULL)
  108.           {
  109.            if(!(strcmp(&Command[2],"ON")))
  110.              Einstellungen.Lock=1;
  111.            else
  112.              Einstellungen.Lock=0;
  113.            AuswurfLock();
  114.            ZeigeCDInfo();
  115.           }
  116.          else
  117.            Res1=Res2=10;
  118.         }
  119.        else
  120.          Res1=Res2=10;
  121.       }
  122.      else
  123.        Res1=Res2=10;
  124.     }
  125.    else if(!(strcmp(&Command[0],"ABOUT")))
  126.     {
  127.      if(*Command[1]!=NULL)
  128.       {
  129.        if(!(strcmp(&Command[1],"CD"))) AboutCD();
  130.        else if(!(strcmp(&Command[1],"DRIVE"))) AboutDrive();
  131.       }
  132.      else
  133.        Information();
  134.     }
  135.    /* --------------------------------------------------- */
  136.    rx->rm_Result1=Res1;
  137.    rx->rm_Result2=Res2;
  138.    ReplyMsg(rx);
  139.    /* --------------------------------------------------- */
  140.    rx=GetMsg(ARexxPort);
  141.   }
  142.  return(iconify);
  143. }
  144.  
  145.